﻿<Window x:Class="ApplicationBoom.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:System="clr-namespace:System;assembly=mscorlib" 
        xmlns:vm="clr-namespace:ApplicationBoom.ViewModel" 
        Title="MainWindow" Height="350" Width="525"  DataContext="{DynamicResource Data}">
    <Window.Resources>
        <vm:MainWindow x:Key="Data"/>
        <Dock x:Key="LabelDock">Top</Dock>
        <System:Double x:Key="LabelWidth">100</System:Double>
        <HorizontalAlignment x:Key="LabelHorizontalAlingment">Left</HorizontalAlignment>
        <System:Double x:Key="ControlWidth">200</System:Double>
        <System:Double x:Key="ControlHeight">24</System:Double>
        <HorizontalAlignment x:Key="ControlHorizontalAlingment">Left</HorizontalAlignment>
        <Thickness x:Key="ControlMargin">3</Thickness>
        <Thickness x:Key="ControlSpacingMargin">3</Thickness>

    </Window.Resources>
    <DockPanel>
        <StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
            <Button Content="Start Update" Command="{Binding StartTimerCommand}"  Margin="{StaticResource ControlSpacingMargin}"/>
            <Button Content="Stop Update" Command="{Binding StopTimerCommand}" Margin="{StaticResource ControlSpacingMargin}"/>
        </StackPanel>
        <TabControl>
            <TabItem Header="Single" DataContext="{Binding TextObject}">
                <StackPanel>
                    <DockPanel Margin="{StaticResource ControlSpacingMargin}" >
                        <TextBlock HorizontalAlignment="{StaticResource LabelHorizontalAlingment}" VerticalAlignment="Center" Text="Index" DockPanel.Dock="{StaticResource LabelDock}" Width="{StaticResource LabelWidth}" />
                        <TextBox HorizontalAlignment="{StaticResource ControlHorizontalAlingment}" Text="{Binding Path=Index, ValidatesOnDataErrors=True, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="{StaticResource ControlWidth}" Height="{StaticResource ControlHeight}" Margin="{StaticResource ControlMargin}" />
                    </DockPanel>
                    <DockPanel Margin="{StaticResource ControlSpacingMargin}">
                        <TextBlock HorizontalAlignment="{StaticResource LabelHorizontalAlingment}" VerticalAlignment="Center" Text="Text" DockPanel.Dock="{StaticResource LabelDock}" Width="{StaticResource LabelWidth}" />
                        <TextBox HorizontalAlignment="{StaticResource ControlHorizontalAlingment}"  Text="{Binding Path=Text, ValidatesOnDataErrors=True, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="{StaticResource ControlWidth}" Height="{StaticResource ControlHeight}" Margin="{StaticResource ControlMargin}" />
                    </DockPanel>
                    <DockPanel Margin="{StaticResource ControlSpacingMargin}">
                        <TextBlock HorizontalAlignment="{StaticResource LabelHorizontalAlingment}" VerticalAlignment="Center" Text="Description" DockPanel.Dock="{StaticResource LabelDock}" Width="{StaticResource LabelWidth}" />
                        <TextBox HorizontalAlignment="{StaticResource ControlHorizontalAlingment}"  Text="{Binding Path=Description, ValidatesOnDataErrors=True, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="{StaticResource ControlWidth}" Height="{StaticResource ControlHeight}" Margin="{StaticResource ControlMargin}" />
                    </DockPanel>
                </StackPanel>
            </TabItem>
            <TabItem Header="Multiple">
                <DataGrid ItemsSource="{Binding Children}"/>
            </TabItem>
        </TabControl>
    </DockPanel>
</Window>